/**
 * Created with IntelliJ IDEA.
 * Description:3、匿名内部类实现Thread
 * User: 东莞呵呵
 * Date:2022-08-30
 * Time:10:38
 */
public class Demo3 {
    public static void main(String[] args) {
        Thread thread=new Thread (){
            @Override
            public void run() {
                while (true){
                    System.out.println("run1");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };
        thread.start();
        while (true){
            System.out.println("run2");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
